* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.upload-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.upload-group {
    margin-bottom: 30px;
}

.upload-group h3 {
    margin-bottom: 15px;
    color: #4a5568;
}

.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.upload-placeholder span {
    color: #718096;
    font-size: 1.1em;
}

.image-preview, .image-previews {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
}

.areas-controls-bottom {
    margin-top: 15px;
    text-align: center;
}

.merchant-areas {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.merchant-area {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    background: #f7fafc;
}

.area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.area-name-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    margin-right: 10px;
}

.area-name-input:focus {
    outline: none;
    border-color: #667eea;
}

.remove-area-btn {
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
}

.remove-area-btn:hover {
    background: #c53030;
}

.area-upload {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.area-upload:hover {
    border-color: #667eea;
    background: white;
}

.area-preview {
    margin-top: 10px;
}

.color-display {
    margin-top: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: flex;
    align-items: center;
    gap: 20px;
}

.color-display-swatch {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-display-details {
    font-family: 'Courier New', monospace;
    flex: 1;
}

.color-display-details div {
    margin-bottom: 5px;
}

.analyze-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.analyze-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

.results-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.reference-color, .top-colors, .visualization {
    margin-bottom: 30px;
}

.color-info {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
}

.color-swatch {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-details {
    font-family: 'Courier New', monospace;
}

.color-details div {
    margin-bottom: 5px;
}

.ranking {
    display: grid;
    gap: 15px;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border-left: 4px solid;
}

.rank-1 { border-left-color: #ffd700; }
.rank-2 { border-left-color: #c0c0c0; }
.rank-3 { border-left-color: #cd7f32; }
.rank-4 { border-left-color: #667eea; }
.rank-5 { border-left-color: #667eea; }

.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-right: 15px;
}

.rank-1 .rank-badge { background: #ffd700; }
.rank-2 .rank-badge { background: #c0c0c0; }
.rank-3 .rank-badge { background: #cd7f32; }
.rank-4 .rank-badge { background: #667eea; }
.rank-5 .rank-badge { background: #667eea; }

.rank-color {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.rank-details {
    flex: 1;
}

.rank-details div {
    margin-bottom: 3px;
}

.deltaE-info {
    background: #f0fff4;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #48bb78;
}

.deltaE-info ul {
    list-style: none;
    padding-left: 0;
}

.deltaE-info li {
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
}

.deltaE-info li:last-child {
    border-bottom: none;
}

#colorCanvas {
    width: 100%;
    max-width: 1000px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 裁剪模态框样式 */
.crop-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.crop-modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.crop-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.crop-modal-header h3 {
    margin: 0;
    color: #2d3748;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #718096;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #2d3748;
}

.crop-container {
    padding: 20px;
    max-height: 60vh;
    overflow: auto;
}

.crop-container img {
    max-width: 100%;
    display: block;
}

.crop-controls {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.add-area-btn {
    background: #48bb78;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.add-area-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

/* 裁剪工具覆盖默认样式 */
.cropper-view-box,
.cropper-face {
    border-radius: 0; /* 改为矩形 */
}

.cropper-view-box {
    outline: 2px solid #667eea;
    outline-color: rgba(102, 126, 234, 0.75);
}

.cropper-line {
    background-color: #667eea;
}

.cropper-point {
    background-color: #667eea;
    width: 8px;
    height: 8px;
}

.cropper-point.point-se {
    width: 12px;
    height: 12px;
}